#include<bits/stdc++.h>
using namespace std;
#define int long long

int n, m;
int a[1000005];

inline bool check(int x, int k) {
	if (x + k - 1 > m)
		return false;

	int cnt = 0;
	vector<bool> vis(m + 1);
	for (int i = 0; i < x; i++) {
		if (!vis[a[i + k]]) {
			vis[a[i + k]] = 1;
			cnt++;
			if (cnt >= m)
				return true;
		}
	}
	return false;
}

signed main() {
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
		cin >> a[i];

	int ans_begin = INT_MAX, ans_len = INT_MAX;
	for (int i = 1; i <= n; i++) {
		int l = m - 1, r = n - i;
		while (l < r) {
			int mid = (l + r) / 2;
			if (check(mid, i)) {
				r = mid;
				if (mid < ans_len) {
					ans_len = mid;
					ans_begin = i;
				}
			} else {
				l = mid + 1;
			}
		}
	}
	cout << ans_begin << " " << ans_begin + ans_len - 1;
	return 0;
}
